package com.shop.shoporder.common;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class StringUtil {

    public static boolean isNumeric(String str) {

        for (int i = str.length(); --i >= 0;) {

            if (!Character.isDigit(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }



    public static String getStringFormatValueOfObject(ObjectMapper objectMapper, Object value) {
        try {
            return objectMapper.writeValueAsString(value);
        } catch (JsonProcessingException e) {
            return "convert to string error!";
        }
    }

}
